package com.jh3502.vivo.function.passchange;

import android.support.annotation.NonNull;

import com.jh3502.vivo.base.BaseCallback;
import com.jh3502.vivo.base.BaseJson;
import com.jh3502.vivo.base.BasePresenter;
import com.jh3502.vivo.base.BaseView;

import java.util.Map;

/**
 * @author harisucici
 * @date 2017/6/19
 */

public class PassChangePresenter extends BasePresenter<PassChangePresenter.PassChangeView> {
    PassChangeModel mPassChangeModel;
    PassChangeView mPassChangeView;


    public void setPassChangeView(PassChangeView mPassChangeView) {
        this.mPassChangeView = mPassChangeView;
    }

    public void toPassChange(Map<String, Object> body) {
        mPassChangeView.showLoadingDialog();
        if (mPassChangeModel == null) {
            mPassChangeModel = new PassChangeModel(mPassChangeView.getActContext());
        }

        mPassChangeModel.changePwd(body, new BaseCallback(mPassChangeView) {
            @Override
            public void responseSuccess(@NonNull BaseJson baseJson) {
                mPassChangeView.changePwdSuccess();
            }
        });
    }


    @Override
    public void cancelCall() {

    }

    public interface PassChangeView extends BaseView {
        void changePwdSuccess();
    }
}
